using System.Collections;

namespace AssetImporter
{
    public interface IOrder
    {
        void Do();
    }

    public interface IOrderManager
    {
        void Add(IOrder order);
        void DoAll();
    }

    public class OrderManager : IOrderManager
    {
        Stack<IOrder> orders;
        public OrderManager()
        {
            orders = new Stack<IOrder>();
        }

        public void Add(IOrder order)
        {
            orders.Push(order);
        }

        public void DoAll()
        {
            while(true)
            {
                if(orders.TryPop(out var order))
                    order.Do();
                else
                    break;
            }
        }
    }
}